package com.loveprogrammer.redismq.listener.handler.impl;

import com.loveprogrammer.redismq.annotation.Listeners;
import com.loveprogrammer.redismq.annotation.MQListener;
import com.loveprogrammer.redismq.listener.handler.BaseHandler;
import com.loveprogrammer.redismq.mq.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName TestHandler
 * @Description
 * @Author admin
 * @Date 2023/10/16 11:17
 * @Version 1.0
 */
@Component
@Listeners(topic = "test2")
public class Test2Handler extends BaseHandler {
    private static final Logger logger = LoggerFactory.getLogger(Test2Handler.class);

    @MQListener(tag = "execute",messageClass = User.class)
    public Boolean execute(String key, User user) {
        logger.info("test2-入参是对象:{} {}" ,user.getName(),user.getAge());
        return Boolean.TRUE;
    }

    @MQListener(tag = "execute2",messageClass = Double.class)
    public Boolean execute2(String key, Double message) {
        logger.info("test2-入参是浮点数:{}" ,message);
        return Boolean.TRUE;
    }
}
